<?php
namespace app\api\model;


use think\Model;
use app\api\model\traits\GoodsTrait;

class Goods extends Common
{
	use GoodsTrait;
    public function getCategoryRecommend($categoryId,$limit = 4)
    {
        $categoryIds = [$categoryId];
        return $this->where('category_id','in',$categoryIds)->limit($limit)->select();
    }
	// 查询推荐商品
	public function getRecommendGoods($field)
	{
		if($field == 'guess'){
			$where = [];
		}else{
			$where = [
				[$field,'=',1]
			];
		}
		return $this->where($where)->limit(5)->with(['category'])->select();
	}
}